<?php
function cek_profpic($pic){
    if($pic == null){
        echo base_url('img/placeholder.png');
    }else{
        echo base_url('img/profpic/'.$pic);
    }
}
?>
<?php foreach ($rows as $row) { ?>
    <tr>
        <td>
            <img src="<?php cek_profpic($row->profpic) ?>" alt="blablabla" class="licek" />
            <span id="id_user"><?php echo $row->id_user; ?></span>
        </td>
        <td>
            <span><?php echo $row->nama; ?></span>

        </td>
        <td><a href="#" id="<?php echo $row->id_user; ?>" class="add btn btn-primary">Add to Group</a></td>
    </tr>
<?php } ?>
    <script type="text/javascript">
        $('.add').click(function(){
            id_group = '<?php echo $id_group; ?>';
            id_user = this.id;
            $.post("<?php echo site_url('dosen/adding'); ?>", { id_group:id_group, id_user:id_user });
            $('#'+id_user).text('Added').addClass('disabled');
        });
    </script>